package cn.silver.module.system.enums;

import cn.silver.framework.core.model.DictModel;
import cn.silver.framework.core.utils.StreamUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @author zhouxiaobo
 */

@Getter
@AllArgsConstructor
public enum DeptPostTypeEnums {
    /**
     * 职务类型
     */
    MANAGER_POST("00", "业务管理", true),
    HR_POST("01", "HR管理", true),
    MAIN_POST("90", "员工", false),
    SECOND_POST("11", "借调", false),
    PART_POST("10", "兼职", false),
    OTHER_POST("99", "其他", false),
    ;
    private final String code;
    private final String name;
    private final Boolean manager;

    public static List<String> getManagers() {
        return Stream.of(values()).filter(DeptPostTypeEnums::getManager).map(DeptPostTypeEnums::getCode).collect(Collectors.toList());
    }

    public static List<DictModel> getModels() {
        return StreamUtils.toList(Arrays.asList(values()), item -> new DictModel(item.name, item.code));
    }
}
